<template>
  <div class="aui-card-list">
  <uni-list-query-card :queryShow="queryShow" @query-click="getDataList()" @click="(e)=>{this.queryShow=e}" @searchReset="searchReset()">
      <el-col :span="6">
        <el-form-item label="表单名称">
          <el-input v-model="dataForm.name" placeholder="表单名称" clearable></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="6">
      <el-form-item label="业务类型">
        <el-select v-model="dataForm.type" placeholder="请选择业务类型">
              <el-option v-for="t in this.$getDictList('BPM_FORM_TYPE', false)" :key="t.val" :label="t.label"
                :value="t.val"></el-option>
            </el-select>
      </el-form-item>
      </el-col>
  </uni-list-query-card>
    <el-card shadow="never" class="aui-card-list-body">
      <vxe-toolbar :setting="{immediate:true}">
        <template v-slot:buttons>
          <el-button v-if="$hasPermission('flowable:bpmFormDef:save')" type="primary" @click="addOrUpdateHandle()">
            {{ $t('add') }}
          </el-button>
          <el-button v-if="$hasPermission('flowable:bpmFormDef:delete')" type="danger" @click="deleteHandle()">
            {{ $t('deleteBatch') }}
          </el-button>
        </template>
        <template v-slot:tools>
          <el-button icon="el-icon-refresh" @click="getDataList()" circle></el-button>
        </template>
      </vxe-toolbar>
      <div class="aui-card-list-body-table">
        <vxe-table :loading="dataListLoading" :data="dataList" ref="xTable" auto-resize class="vxe-table-element"
          remote-sort @sort-change="dataListSortChangeHandle" @select-change="dataListSelectionChangeHandleVex"
          @select-all="dataListSelectionAllChangeHandleVex" max-height="auto">
          <vxe-table-column type="checkbox" width="50" align="center"></vxe-table-column>
          <vxe-table-column field="name" title="表单名称"></vxe-table-column>
          <vxe-table-column field="type" title="业务类型" width="120" align="center">
            <template slot-scope="scope">
              {{ $getDictLabel('BPM_FORM_TYPE', scope.row.type) }}
            </template>
          </vxe-table-column>
          <vxe-table-column field="remark" title="备注信息"></vxe-table-column>
          <vxe-table-column field="updateDate" title="更新时间" width="140" align="center">
          </vxe-table-column>
          <vxe-table-column title="handle" fixed="right" width="120" align="center">
            <template slot-scope="scope">
              <el-button v-if="$hasPermission('flowable:bpmFormDef:update')" icon="el-icon-edit" type="text"
                size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}
              </el-button>
              <el-button v-if="$hasPermission('flowable:bpmFormDef:delete')" icon="el-icon-delete" type="text"
                size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}
              </el-button>
            </template>
          </vxe-table-column>
        </vxe-table>
        <el-pagination :current-page="page" :page-sizes="[10, 20, 50, 100]" :page-size="limit" :total="total"
          layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
          @current-change="pageCurrentChangeHandle">
        </el-pagination>
        <!-- 弹窗, 新增 / 修改 -->
        <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
      </div>
    </el-card>
  </div>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './bpmFormDef-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/flowable/bpmFormDef/page',
        getDataListIsPage: true,
        deleteURL: '/flowable/bpmFormDef',
        deleteIsBatch: true
      },
      dataForm: {
        name: '',
        type: ''
      }
    }
  },
  components: {
    AddOrUpdate
  }
}
</script>
